/**
 * Created by wzj on 2017/5/17.
 */


/**
 *
 * Created by WangZhenJia on 2017/5/17.
 */
function JBSFrame_chgList(){
	JBSFrame.call(this);

	var self = this;
	self.chglist_table = null;

	//过滤数据
	self.filterData = {};

	self.initUI = function(){
		//渲染表格
		self.chglist_table = ReactDOM.render(<RTable url="" />,document.getElementById("component-table"));

		window.setInterval(function(){
			//self.chglist_table.ajaxRequestData()
		},1000);

		//开始时间绑定
		$("#filter-beginDate").on("dp.change",function(e){
			if(e.date == false){
				$("#filter-endDate").val("");
			}else {
				$("#filter-beginDate").val(self.formatDate(new Date(e.date).getTime()));
			}
			changeBeginDate();
		}.bind(self));

		//结束时间绑定
		$("#filter-endDate").on("dp.change",function(e){
			if(e.date == false){
				$("#filter-endDate").val("");
			}else{
				$("#filter-endDate").val(self.formatDate(new Date(e.date).getTime()));
			}
			changeEndDate();
		}.bind(self));
	}

	self.getFilterData = function(){
		self.filterData = {
			custAcctId:$("#custAcctId").val(),
			begin:$("#filter-beginDate").val(),//开始日期
			end:$("#filter-endDate").val()//结束日期
		}
	}
}


function customFormatterOperation(cell,row){
	//已发送 未复核
	if (row.status==1){
		return "<a href='javascript:payAgent("+cell+")'>代理</a> <a href='javascript:payForce("+cell+")'>强制</a> <a href='javascript:payCancel("+cell+")'>撤销</a>";
	}
	//已经创建但银行未接受的付款请求可以删除
	if (row.status==0){
		return "<a href='javascript:delSettPay("+cell+")'>删除</a>";
	}
	if ((row.status==2||row.status==4)&&row.funcFlag==1){
		return "<a href='javascript:unFreezeSettPay("+cell+")'>释放</a>";
	}
}



/*
 //body load
 --------------------------------------------------------------------*/
var esteel_chglist;
$(document).ready(function(e) {
	esteel_chglist = new JBSFrame_chgList();
	//初始化UI
	esteel_chglist.initUI()
});

//开始日期
function changeBeginDate(target){
	esteel_chglist.getFilterData();
	esteel_chglist.chglist_table.ajaxRequestData(esteel_chglist.filterData,1);
}
//结束日期
function changeEndDate(target){
	esteel_chglist.getFilterData();
	esteel_chglist.chglist_table.ajaxRequestData(esteel_chglist.filterData,1);
}